package com.yw.atp.service;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.yw.atp.model.Department;


@Repository
@Transactional
public class DepartmentService{
	@PersistenceContext
    private EntityManager em;
	public List<Department> getDepartments(Department depart){
		Query q = em.createNamedQuery("Department.getDepartments");
		q.setParameter("dpartName","%"+depart.getName()+"%");
		return (List<Department>)q.getResultList();
	}
}
